import java.io.*;
import java.net.*;

public class SiimuServer{
	public static void main(String[] arg) throws Exception{
		 ServerSocket ss=new ServerSocket(2525);
		 int nr=0;
		 while(true){					
		 Socket sc=ss.accept();
		 System.out.println(sc);
		 PrintWriter vorku=new PrintWriter(sc.getOutputStream(), true);
		 nr++;
		 vorku.println("Siimu programm ütleb "+nr+" tere");
		 vorku.println("Kes sa oled?");
		 BufferedReader br=new BufferedReader(new InputStreamReader(sc.getInputStream()));
		 String kirjeldus=br.readLine();
		 vorku.println("Tsau, "+kirjeldus);		 
		 sc.close();
		
		}
	}
}